package com.impak.infoot.service.impl

import com.impak.infoot.service.IMatchService
import com.impak.infoot.domain.foot.Match
import com.impak.infoot.domain.foot.Day

/**
 * Implementation of the interface IMatchService
 * @author nzouabi
 *
 */
class MatchService implements IMatchService {

	def getMatch( matchId) {
		Match.get(matchId)
	}

	def getBestMatchOfDay(dayId) {
	}

	def getMatchsBetweenTwoDates(seasonId,  dateA,  dateB) {
	}

	def getBestMatchOfSeason(seasonId) {
	}

	def getMatchsBetweenTwoSeasonDays(dayA,  dayB) {
	}

	def getMatchsOfDay(dayId) {
		def day = Day.get(dayId)
		def matchs = null
		if(day) {
			matchs = Match.findAllByDay(day)
		}
	}

	def getMatchsOfSeason(seasonId) {
		def season = Season.get(seasonId)
		def matches = null
		if(season) {
			def days = Day.findAllBySeason(season)
			if(days) {
				matches = []
				days.each { it ->
					matches << getMatchsOfDay(it.id)
				}
			}
		}
	}
}
